<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <body>

        <ui:composition template="./PrincipalTemplate.xhtml">

            <ui:define name="top">
                Eli
            </ui:define>

            <ui:define name="left">
                <p:commandLink value="Back to Principal Menu" action="PrincipalMenu"/>
            </ui:define>

            <ui:define name="content">
                <h1>Musical Genres List</h1><br/>

                <h:form> <f:view>
                        <p:commandButton action="CreateEditMusicalGenres" value="Register Musical Genres" actionListener="#{musicalGenresBean.prepararNuevo}" ajax="false"/>

                        <h1><h:outputText value="List"/></h1>
                        <p:dataTable value="#{musicalGenresBean.musicalGenresList}" var="item" scrollable="true" scrollHeight="150">
                            <p:column>
                                <f:facet name="header">
                                    <h:outputText value="Idgenre"/>
                                </f:facet>
                                <h:outputText value="#{item.idgenre}"/>
                            </p:column>
                            <p:column filterBy="#{item.name}">
                                <f:facet name="header">
                                    <h:outputText value="Name"/>
                                </f:facet>
                                <h:outputText value="#{item.name}"/>
                            </p:column>
                            <p:column>
                                <f:facet name="header">
                                    <h:outputText value="Edit"/>
                                </f:facet>
                                <center>
                                    <p:commandButton value="Edit" action="CreateEditMusicalGenres" actionListener="#{musicalGenresBean.prepararEditar}" ajax="false">
                                        <f:setPropertyActionListener value="#{item}" target="#{musicalGenresBean.musicalGenres}"/>
                                    </p:commandButton>
                                </center>

                            </p:column>
                            <p:column>
                                <f:facet name="header">
                                    <h:outputText value="Delete"/>
                                </f:facet>
                                <center>
                                    <p:commandButton value="Delete" action="ConfirmMusicalGenres" actionListener="#{musicalGenresBean.prepararEliminar}" ajax="false">
                                        <f:setPropertyActionListener value="#{item}" target="#{musicalGenresBean.musicalGenres}"/>
                                    </p:commandButton>
                                </center>
                            </p:column>
                        </p:dataTable>
                    </f:view>    </h:form>

            </ui:define>
        </ui:composition>
    </body>
</html>
